﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using secondhand.L3object;
using secondhand.L2busslogic;
using secondhand.L1database;

namespace secondhand.L4view
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button5_Click(object sender, EventArgs e)
        {

            if (TextBox1.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('用户名不能为空 ');</script>");
                return;
            }
            if (TextBox2.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('密码不能为空 ');</script>");
                return;
            }
            if (TextBox3.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('手机号码不能为空 ');</script>");
                return;
            }
            if (TextBox4.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('邮箱不能为空 ');</script>");
                return;
            }
            salerOB mydd = new salerOB();
            mydd.saler_name = TextBox1.Text;
            mydd.pass_word = TextBox2.Text;
            mydd.saler_num = TextBox3.Text;
            mydd.saler_mail = TextBox4.Text;
            mydd.saler_count = "0";
            if (!salerBL.Addfill(mydd))
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('注册不成功 ');</script>");
                return;
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('注册成功!');{location.href='saler_login.aspx'}</script>");
                return;
            }
        }
    }
}